Skip to content

Conversation

adri1197
Copy link

@stefanprodan
Copy link
Member

This will cause drift on every apply, even if no objects have been modified in source, so this can't go in.

@stefanprodan stefanprodan added the invalid This doesn't seem right label Sep 22, 2025
@adri1197
Copy link
Author

This will cause drift on every apply, even if no objects have been modified in source, so this can't go in.

I was thinking about comparing the status.LastAppliedRevision with the input revision at apply. If equals, it means that there is no change in the revision source and therefore, the annotation does not need to be added. No drift.

If your concern goes more on, if the revision annotation is going to be added regardless of being a modified file/resource controlled by the Kustomization, some kind of dry-run could be used to detect any drift between. However, I don't see this as a good approach resource as well as time wise.

cmeta.Annotations = make(map[string]string)
}
for k, v := range revisionAnnotations {
cmeta.Annotations[k] = v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we annotating all resources? A Kubernetes deployment will never send an event to NC. This will cause drift for potentially thousands of non-Flux resources, which negates one of the core Flux design principles, we never alter the cluster state, unless a change is made in Git; in this case, no change was made in Git, you just blindly mutate all objects.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry.. this was just a raw implementation. Of course, there is no need to add the annotation in non-FluxCD resources. In any case and as far as I understood, it wouldn't fly due to mutating the objects at applying, been a drift between the source and what's applied and therefore, as you said, altering the cluster state.

I thought that to properly populate the revision over the resources controlled by a Kustomization, it should get spread over from that, because it does have full-control about what's going get applied in the cluster in the end.

Do you have any suggestion about how to tackle this? I think it's a valid use case, especially when you rely on having most of your FluxCD resources in a source/several sources and reconciling from them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants